package com.hong.controller;

import com.hong.api.CommonResult;
import com.hong.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiaohongtao
 * @version 1.0
 * @since 2021年01月20日
 */
@RestController
public class LoginController {
    @RequestMapping(value = "/admin/login", method = RequestMethod.POST)
    public CommonResult<Object> login(@RequestBody User user) {
        if ("admin".equals(user.getUsername()) && "123456".equals(user.getPassword())) {
            return CommonResult.success("admin");
        } else {
            return CommonResult.validateFailed();
        }
    }

}
